package mysql

import (
	"log"

	"github.com/spf13/viper"
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

var MDB *gorm.DB

func Init() {
	addr := viper.GetString("mysql.addr")
	MDB, err := gorm.Open(mysql.Open(addr), &gorm.Config{})
	if err != nil {
		panic(err)
	}
	log.Println("MYSQL connected", MDB)
}
